package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {

    //插入多条口味数据
    Integer save(@Param("dishFlavorList") List<DishFlavor> dishFlavorList);


    //根据id删除该菜品的口味
    @Delete("delete from dish_flavor where dish_id=#{dishId}")
    Integer deleteById(Long id);


 //根据菜品id获取口味列表数据
    @Select("select * from dish_flavor where dish_id=#{dishId} and is_deleted=0")
    List<DishFlavor> findByDishId(Long dishId);
}